package io.seata.factoryservice.controller;

import io.seata.factoryservice.entity.ProductionPlan;
import io.seata.factoryservice.service.ProductionPlanService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by IntelliJ IDEA.
 *
 * @Author : author
 * @create 2022/8/21 19:23
 */

@RestController
public class ProductionController {

    @Autowired
    ProductionPlanService productionPlanService;

//    @PostMapping("/getMaterial")
//    public void getMaterial(@RequestBody ProductionPlan productionPlan) {
//        String ppstyle = productionPlan.getPpstyle();
//        if (ppstyle.equals("氢氧化钠")) {
//            NaohMaterial naohMaterial=productionPlanService.calculationNaohMaterial(productionPlan);
//            System.out.println("openfein传递naohMaterial到原材料仓库");
//        } else if (ppstyle.equals("碳酸氢钠")) {
//            Nahco3Material nahco3Material=productionPlanService.calculationNahco3Material(productionPlan);
//            System.out.println("openfein传递nahco3Material到原材料仓库");
//        } else {
//            Nh3Material nh3Material=productionPlanService.calculationNh3Material(productionPlan);
//            System.out.println("openfein传递nh3Material到原材料仓库");
//        }
//    }

    @PostMapping("/production")
    public void addProductionPlan(@RequestBody ProductionPlan productionPlan){
        productionPlanService.addProductionPlan(productionPlan);
    }
}
